<?php
/**
 * (actions)
 */
namespace App\Admin\Actions\Purchase;

use Encore\Admin\Grid\Tools\BatchAction;
class BatchPlan extends BatchAction
{
    public function script()
    {
        return <<<EOT
var selectedRows = function () {
    var selected = [];
    $('.grid-row-checkbox:checked').each(function(){
        selected.push($(this).data('id'));
    });
    return selected;
}

$('{$this->getElementClass()}').on('click', function() {
    var ids = $.admin.grid.selected();
    if(!ids){
        swal('请选择单据', '', 'error');
        return false;
    }
    location.href = '/xqc/purchase/plan-confirm?ids=' + ids;
});

EOT;

    }
}
